package com.yb.xczx.cloud.passport.controller;

import com.alibaba.csp.sentinel.EntryType;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/25 15:54
 * FileName: SentinelResourceController
 * Description:
 */

@RestController
@Slf4j
public class SentinelResourceController {

    @GetMapping("test")
    @SentinelResource(value = "test",fallback = "testFallback",blockHandler = "testBlockHandler")
    public String test(){
        log.info("test");
        return "test";
    }


    public String testFallback( Throwable throwable){
        log.info("testFallback");

        return "testFallback";
    }

    public String testBlockHandler(BlockException blockException){
        log.info("testBlockHandler");
        return "testBlockHandler";
    }
}
